///////////////////////////////////////////////////////////
//  CCreateCheckListView.h
//  Implementation of the Class CCreateCheckListView
//  Created on:      21-Sep-2013 9:36:21 AM
//  Original author: Jakkaphan Aiemcharoenjit
///////////////////////////////////////////////////////////

#if !defined(EA_3E68A7C1_9C93_43b7_A524_80CA6DE66595__INCLUDED_)
#define EA_3E68A7C1_9C93_43b7_A524_80CA6DE66595__INCLUDED_

#include "IViewCtrl.h"
#include "IPage.h"
#include "IWindowDirector.h"

using namespace Data;

namespace UI
{
class CCreateCheckListView : public IViewCtrl
{

public:
  CCreateCheckListView(IWindowDirector* director);
	virtual ~CCreateCheckListView();
	virtual IViewCtrl::ViewType GetType() const;
	virtual void Initialize();
	virtual void Refresh();
	virtual void ShowView(bool show = true);
	void OnClickedSave();
	void OnClickedBack();
	void OnClickedChoice();
	void SetPage(IPage* page);
	IPage* GetPage();
  void RemovePage();
  void SetTitleView(const std::string& text);
  void EditData(int newChoice);
  int GetCurChoice();

private:
  void AddTableRow(IObject* item, bool isChild = false);
  CTableItemPtr CreateTableRow(IObject* item, bool isChild = false);

private:
  bool OnClickedNevigationBar(CNavigationBar *naviBar, int button);
  bool OnSelectedTable(CTable *table, int tab);
  bool OnAlertButtonClick(CAlertDialog* dialog, EAlertDialogButton button);

private:
	IViewCtrl::ViewType   m_type;
	IPage*                m_checkListPage;
	IWindowDirector*      m_parrentWnd;
  CNavigationBarPtr     m_navigationBar;
  CTablePtr             m_table;
  std::vector< std::pair< IObject*, CTableItemPtr > > m_tableRows;
  int                   m_currentRow;
  CAlertDialogPtr       m_alretDlg;
};
}
#endif // !defined(EA_3E68A7C1_9C93_43b7_A524_80CA6DE66595__INCLUDED_)
